<?php
include '../library/config.php';
include '../library/connect.php';

//request #movies for id generation
$intmovie = mysql_query("SELECT COUNT(movieID) AS movieID FROM p1_Movies");
$actors = mysql_query("SELECT a.actorID, a.actorName FROM p1_actors as a ORDER BY a.actorName");

$moviecount = mysql_fetch_array($intmovie);
$movieID = $moviecount['movieID'] +1;
include '../library/disconnect.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="admin.css" type="text/css" />
<title>Add Movie</title>
</head>

<body>
<form enctype="multipart/form-data" action="addmovie.php" method="POST">
<input type="hidden" name="movieID" value="<?php echo $movieID;?>" />
<table>
<tr>
<td>Title</td><td><input type="text" size="20" maxlength="45" name="title"/></td>
</tr>
<tr>
<td>Description:</td><td><textarea cols="40" rows="10" name="description"></textarea></td>
</tr>
<tr>
<td>Director:</td><td><select name="director">
<?php
while($row = mysql_fetch_array( $actors )) {
	// Print out the contents of each row into an option
	echo "<option value='"
	echo $row['actorID'];
	echo "'>";
	echo $row['actorName'];
	echo "</option>";
	echo /n;	
}
?>
</select> <a href="newactor.php">Add new director/actor</a></td>
</tr>
<tr>
<td>Release date (dd/mm/yyyy):</td><td><input type="text" size="2" maxlength="2" name="day" /> / <input type="text" size="2" maxlength="2" name="month" /> / <input type="text" size="4" maxlength="4" name="year" /></td>
</tr>
<tr>
<td></td><td></td>
</tr>
<tr>
<td>Youtube embedlink:</td><td><input name="movieflv" type="text" size="20" maxlength="45" /></td>
</tr>
<tr>
<td>Image:</td><td><input name="uploaded" type="file" size="20" /></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>